package com.ehualu.check.db;

/**
 * Copyright © 2017 sdjictec.Co.Ltd. All rights reserved.
 **/


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class DBCloseUtills {

    private static final Logger LOG = LoggerFactory.getLogger(DBCloseUtills.class);

    public void release(Connection conn, Statement st, ResultSet rs) {

        if (rs != null) {
            try {


                rs.close();
                LOG.info("close ResultSet");
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

        if (st != null) {

            try {
                st.close();
                LOG.info("close Statement");


            } catch (SQLException e) {
                e.printStackTrace();
            }

        }

        if (conn != null) {

            try {
                conn.close();
                LOG.info("close Connection");


            } catch (SQLException e) {
                e.printStackTrace();
            }

        }


    }
}
